{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import datasets\n",
    "\n",
    "X, y = datasets.make_moons()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100, 2)"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100,)"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAd7ElEQVR4nO3df5Ac9Xnn8ffDagVrY2vBWtuwkiK5otjBQCyzJcdR7g5bGAvqQATbGBwnkIOofD7iyy+XRdmFKaVciFAOhjJJTkecQHIBZJvIsi0XjhFO6lyBYzG/jTGyEsKuVLABpJiwwEp67o/pQaPZ7tmZ7Z7ub3d/XlWqnR+t6W/PfL/P9Dz99LfN3RERkeo7qugGiIhIPhTwRURqQgFfRKQmFPBFRGpCAV9EpCYWFN2AJIsXL/bly5cX3QwRkVK5//77/83dR+KeCzbgL1++nPHx8aKbISJSKmb2VNJzSumIiNSEAr6ISE0o4IuI1IQCvohITSjgi4jUhAK+iEhNKOCLiNREJnX4ZvYV4L8Cz7r7yTHPG3A9cDbwEnCJu/8wi3VLmL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p8APhE9b8CN0XY+QkKFW9H/utiOy1s+j3uAXym6zQnb8as00jMPAw9G/87O4zPR1AoiIjVRx5SOiEgtKeCLiNSEAr6ISE0o4IuI1IQCvohITSjgi4jUhAK+iEhN/H9OcJaKidMdbAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAD4CAYAAADhNOGaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3dfbBdVZnn8e+PGDQ99iThRYWEK1DD4CuCfQdsmeqWFwHtasP4QoPjGKuwUlTrOGNXU8ayC63YU0atbnussbuNimJXD4ioGBUHMdGxRkW5NDEBHSRAK3kZSYtJ65AJITzzx9kXzj337PO6z95rn/37VN265+y9zz0rO+fsZ6+1nrWWIgIzM2uuo6ougJmZVcuBwMys4RwIzMwazoHAzKzhHAjMzBruaVUXYBTHHXdcnHzyyVUXw8ysVu68885/iojjO7fXMhCcfPLJzM3NVV0MM7NakfSzbtvdNGRm1nAOBGZmDedAYGbWcA4EZmYN50BgZtZwhQQCSddKeljS3Tn7/72k7dnP9yS9pG3fP0raIWmbJKcCmZmVrKgawWeAS3rsfxD4/Yg4A3g/sKlj/3kRcWZEzBZUHjMzG1Ah4wgi4juSTu6x/3ttT28HVhfxvpaWm+/azYdvvZc9+w9y4oplXH3x6Vx61qqqi2VmfVTRR3Al8PW25wF8Q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qLlEfAp4CcR8Zc5h9XjHFfdW12XH+Df0Yruh4BfALdm208Ebmk77tW0sgfup9WkVFV5jwW2APdlv4/Jts8Cn8wevxzYQSv7ZQdwZQXlXHS+gA3Aa7LHzwA+D+wEfgicWvHnoF95PwDck53TbwHPq7Cs1wN7gcPZZ/dK4Crgqmy/gI9l/5Yd5GTDJVTet7ed29uBl1dc3n9Lq5lnO7At+3l1yuc478dTTJiZNZybhszMGs6BwMys4RwIzMwazoHAzKzhHAjMzBrOgcDMrOEcCMzMGu7/A8wmoSM0XtHFAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "X, y = datasets.make_moons(noise=0.15, random_state=666)\n",
    "\n",
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用多项式特征的SVM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import PolynomialFeatures, StandardScaler\n",
    "from sklearn.svm import LinearSVC\n",
    "from sklearn.pipeline import Pipeline\n",
    "\n",
    "def PolynomialSVC(degree, C=1.0):\n",
    "    return Pipeline([\n",
    "        ('poly', PolynomialFeatures(degree=degree)),\n",
    "        ('std_scaler', StandardScaler()),\n",
    "        ('linearSVC', LinearSVC(C=C))\n",
    "    ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Pipeline(memory=None,\n",
       "         steps=[('poly',\n",
       "                 PolynomialFeatures(degree=3, include_bias=True,\n",
       "                                    interaction_only=False, order='C')),\n",
       "                ('std_scaler',\n",
       "                 StandardScaler(copy=True, with_mean=True, with_std=True)),\n",
       "                ('linearSVC',\n",
       "                 LinearSVC(C=1.0, class_weight=None, dual=True,\n",
       "                           fit_intercept=True, intercept_scaling=1,\n",
       "                           loss='squared_hinge', max_iter=1000,\n",
       "                           multi_class='ovr', penalty='l2', random_state=None,\n",
       "                           tol=0.0001, verbose=0))],\n",
       "         verbose=False)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly_svc = PolynomialSVC(degree=3)\n",
    "poly_svc.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*100)).reshape(-1,1),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*100)).reshape(-1,1)\n",
    "    )\n",
    "    X_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "\n",
    "    y_predict = model.predict(X_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A','#FFF59D','#90CAF9'])\n",
    "\n",
    "    plt.contourf(x0, x1, zz, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3df5Ac5Z3f8fdXqz20xisWGXTIEkbGBmIwiWQozj6lEorDF0tOgS8n57ClOpmyo3JygFxUqsxFV1yKKirmUkWVwL44Op85Obj8I0ri42KpOGTsOKUEx/y0WDjJgjJmpbXFj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2yyjn24DvAD+O/l0SPX8l8KXo8W8D+6LruQ/4ZIHle9P1Ae4AroseLwL+K3AQ+H/AhSW9L/uV8z9E78WngO8C/6CEMn4NmAZORO/NTwKfBj4dvW60Nql6Lvo7J2bxlVzOmzqu5SPAb5dQxn9Mq/vnR8CT0de60K5nynJmvp5aukJERICKdRmJiEh+FBBERARQQBARkYgCgoiIAAoIIiISUUAQERFAAUFERCL/Hx8HB53HVRsUAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(poly_svc, axis=[-1.5,2.5,-1.0,1.5])\n",
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用多项式核函数的SVM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import StandardScaler\n",
    "from sklearn.svm import SVC\n",
    "from sklearn.pipeline import Pipeline\n",
    "\n",
    "def PolynomialKernelSVC(degree, C=1.0):\n",
    "    return Pipeline([\n",
    "        ('std_scaler', StandardScaler()),\n",
    "        ('kernelSVC', SVC(C=C, kernel='poly', degree=degree))\n",
    "    ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Pipeline(memory=None,\n",
       "         steps=[('std_scaler',\n",
       "                 StandardScaler(copy=True, with_mean=True, with_std=True)),\n",
       "                ('kernelSVC',\n",
       "                 SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,\n",
       "                     decision_function_shape='ovr', degree=3,\n",
       "                     gamma='auto_deprecated', kernel='poly', max_iter=-1,\n",
       "                     probability=False, random_state=None, shrinking=True,\n",
       "                     tol=0.001, verbose=False))],\n",
       "         verbose=False)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "poly_kernel_svc = PolynomialKernelSVC(degree=3)\n",
    "poly_kernel_svc.fit(X, y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAf2klEQVR4nO3df5Bd5X3f8fdXuzJakwUhC4WNhJAJPyICLQINjqM6pQ5OLTmDklieYqtTzNijcVOgbqYzJVVH6TDjid3OkBjj1lWIE9zpGLty6ii1GIIMDB61uMYYjIQiWTAWXrGx+BGkJV6ZXenpH/fc9d2rc+49597nnPOccz6vGY3u3nt0z6O7u+f7/Pg+32POOURERBaV3QAREQmDAoKIiAAKCCIiElFAEBERQAFBREQiCggiIgJ4Cghm9kUzO25m+xNev9HMTpjZM9GfHT7OKyIi/ox6ep8/B+4DvtTjmG85537T0/lERMQzLyME59wTwOs+3ktERMrha4SQxrvN7FngZeDfOucOdB9gZtuAbQDnnnPO9ZdfdFGBzRMRqb5njh591Tl34SD/tqiA8DRwiXPuTTPbBHwduLz7IOfcTmAnwLo1a9xj27cX1DwRkXq4YNu2o4P+20KyjJxzJ51zb0aP9wCLzWx5EecWEZF0CgkIZnaRmVn0+IbovK8VcW4REUnHy5SRmX0ZuBFYbmaTwB8AiwGcc18AtgD/0szmgBngFqcyqyIiQfESEJxzH+7z+n200lJFRCRQ2qksIiKAAoKIiEQUEEREBFBAEBGRiAKCiIgACggiIhJRQBAREUABQUREIgoIIiICKCCIiEhEAUFERAAFBBERiSggiIgIoIAgIiKRIu+pLDW2Z3qMz70+z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t3Av4iyY34FONGeTgyJmV3UXicysxtoXZ9e6/2vvLfBgD8FDjrn7kk4rPTPM007B/o8i14d77Fq/tu0Iu9PgR8DD0fP/wKwJ3p8Ka1Mj2eBA7SmcIJrp/tZJsJhWr3tMtr5DuCbwA+iv5dFz68H7o8e/yrwXPR5Pgd8rMD2nfX5AHcDN0ePlwD/EzgC/D/g0pJ+Lvu18w+jn8VngceAXyqhjV8GpoDZ6GfzY8AngE9Erxutm1S9EH2fE7P4Sm7n7R2f5ZPAr5bQxn9Ea/rn+8Az0Z9NoX2eKduZ+fNU6QoREQEqNmUkIiL5UUAQERFAAUFERCIKCCIiAiggiIhIRAFBREQABQQREYn8f/oq42RZc5GcAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(poly_kernel_svc, axis=[-1.5,2.5,-1.0,1.5])\n",
    "plt.scatter(X[y==0,0],X[y==0,1])\n",
    "plt.scatter(X[y==1,0],X[y==1,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
